import os
import sys
from tqdm import tqdm
from utils import ReadXml
import numpy as np

Path = r"J:\Temp\Circle\Big"

error = []
for root, dirs, files in os.walk(Path):
    for file in tqdm(files):
        if file[-1] == "l":
            Infos = ReadXml(root + "\\" + file)
            Coordinates = np.array(Infos)[:, :-1].astype(int)  # Maybe infos is None!Please run 'CountLabelNum' first!
            Labels = np.array(Infos)[:, -1].astype(int)
            TrueLabel = file.split("_")[-1][:-4]
            Xsort = np.argsort(- Coordinates[:, 0])
            value = 0
            for i, index in enumerate(Xsort):
                value += Labels[index] * np.power(10, i)

            if TrueLabel != str(value) and TrueLabel != "RemoveLimit" + str(value) and TrueLabel != "RemoveLimit-" + str(value):
                error.append(file)
print(error)
